//
//  HTCommitView.m
//  TruckDriver
//
//  Created by Ting Han on 2017/9/26.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "HTCommitView.h"
#import "UIView+Layout.h"
@interface HTCommitView ()
@property (nonatomic,strong)UIButton *button;
@end

@implementation HTCommitView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupSub];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title{
    self = [super initWithFrame:frame];
    if (self) {
        self.title = title;
        [self setupSub];
    }
    return self;
}
- (void)setupSub{
    self.backgroundColor = kBackgroundColor;
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(20, 10, self.frame.size.width - 40, kWidth(55)/4.0*3);
    button.layer.masksToBounds = YES;
    button.layer.cornerRadius = 4;
    button.backgroundColor = kBlueColor;
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button setTitle:self.title forState:UIControlStateNormal];
    button.bottom = self.bottom-10;
    [self addSubview:button];
    self.button = button;
}
- (void)setTitle:(NSString *)title{
    _title = title;
  [self.button setTitle:self.title forState:UIControlStateNormal];
}

@end
